package io.gitee.xyuesheng.day06;

import org.junit.Test;

import java.util.HashSet;
import java.util.Set;

public class HomeworkDNA {
    @Test
    public void testDna() {
        String s = new String("AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT");

        Set<String> set1 = new HashSet<>();
        Set<String> set2 = new HashSet<>();

        for (int i = 0; i < s.length() - 9; i++) {
            String part = s.substring(i, i + 10);
//            System.out.print("i:"+i+" ");
//            System.out.println(part);
            if (!set1.contains(part)) {
                set1.add(part);
            } else {
                set1.add(part);
                set2.add(part);
            }
        }
        System.out.println(set2);
    }


}
